﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using imaginecup.objectManager;
using imaginecup.information;
using Imaginecup.gameState.malaria.componentInit;
using Microsoft.Xna.Framework;

namespace Imaginecup.gameState.malaria.component.entity.fieldItem
{
    public class CmpWeb : BaseEntityComponent
    {
        private ICmpMalaria m_Malaria;
        private double m_DelayTime;

        public CmpWeb(GObjectID a_GID, ObjectManager objMan , ICmpMalaria malaria , double delayTime  )
            : base(a_GID, objMan, ComponentTypeID.CID_OBSERVER_CHAR)
        {
            m_Malaria = malaria;
            m_DelayTime = delayTime;
        }

        public override void Update(GameTime gameTime)
        {
            m_DelayTime -= gameTime.ElapsedGameTime.TotalSeconds;

            if (m_DelayTime <= 0)
            {
                m_Malaria.ReleaseStop();
                m_ObjectMan.DestroyObject(m_ObjectID);
                return;
            }

         
            base.Update(gameTime);
        }

        public override EMessageResult HandleMessage(GMessage a_Msg)
        {
            return base.HandleMessage(a_Msg);
        }


    }
}
